﻿@{
    ViewBag.Title = "个人业务业绩对比母页";
    Layout = "~/Areas/IM/Views/Shared/_Layout.cshtml";
}

@section Scripts{
    <script type="text/javascript">

        $.setDivOnly('#divIndex');


        $(document).ready(function () {
            DisableBackspace();
            //$.InitDateTime();
            $.InitMonthFirstDateTime();

            $("#youxiuImg").hide(); $("#lianghaoImg").hide(); $("#yibanImg").hide();
            getPersonalInfo();
            //getTotalInfo();


        });
        function reSearch() {
            getPersonalInfo();
            getTotalInfo();

        }

        //作比较，大于返回红，小于返回绿
        function CompareInt(a, b) {
            if (parseInt(a) > parseInt(b)) {
                return 'red';
            }
            else if (parseInt(a) < parseInt(b)) {
                return 'green';
            }
            else return 'black';
        }
        function CompareFloat(c, d) {
            if (parseFloat(c) > parseFloat(d)) {
                return 'red';
            }
            else if (parseFloat(c) < parseFloat(d)) {
                return 'green';
            }
            else return 'black';
        }

        //算 大于多少
        function CompareMath(e, f) {
            if (parseInt(e) > parseInt(f)) return (parseInt(e) - parseInt(f));
            else if (parseInt(e) < parseInt(f)) return (parseInt(f) - parseInt(e));
            else return 0;
        }

        function CompareFloatMath(g, h) {
            if (g > h) return g - h;
            else if (g < h) return h - g;
            else return 0;
        }

        function ComparePercentMath(i, j) {
            if (parseFloat(i) > parseFloat(j)) {
                return (parseFloat(i) - parseFloat(j));
            }
            else if (parseFloat(i) < parseFloat(j)) {
                return (parseFloat(j) - parseFloat(i));
            }
            else return 0.00;
        }

        //取2位小数
        function myFix(num) {
            if (isNaN(parseFloat(num))) {
                return false;
            } else {
                return Math.round(num * 100) / 100;
            }
        }
        //百分比
        function percentNum(num, num2) {
            return (Math.round(num / num2 * 10000) / 100.00 + "%"); //小数点后两位百分比
        }
        //将只有秒数的时间翻译成时分秒
        function formatSecondTime(secondtime) {
            var resualt = "";
            if (parseInt(secondtime) >= 3600) {
                resualt = parseInt(secondtime / 3600) + " 小时" + parseInt((secondtime % 3600) / 60) + " 分" + ((secondtime % 3600) % 60) + " 秒";
            }
            else if (parseInt(secondtime) >= 60 && parseInt(secondtime) < 3600) {
                resualt = parseInt(secondtime / 60) + " 分" + (secondtime % 60) + " 秒";
            }

            else {
                resualt = secondtime + " 秒";
            }
            return resualt;
        }

        var ComPTaskTimesEveryDay; //声明全局变量，用于对比
        var ComvPAvgSendTime;
        var ComvPAvgArriveTime;
        var ComvPAvgLocalAidTime;
        var ComvPAvgTransTime;
        var ComvPAvgHospitalTransTime;
        var ComvPAvgReactTime;
        var ComvPAvgTurnTime;
        var ComPDisposePercent;
        var ComPVeinPercent;
        var ComPROSCPercent;

        function getPersonalInfo() {
          
            $.ajax({
                type: 'POST',
                url: '@Url.Content("~/BB/TJRedirectLink/GetPersonalStatistics")',
                data:
                    {
                        beginTime: $('#StartDate').datebox('getValue'),
                        endTime: $('#EndDate').datebox('getValue')
                    },
                dataType: "json",
                success: function (jsData) {
                    //个人调度块
                    if (jsData.PSInfo.PTaskTimes > 0) {

                        $('#PTaskTimes').html(jsData.PSInfo.PTaskTimes);

                        $('#PFirstAidTimes').val(jsData.PSInfo.PFirstAidTimes);
                        $('#PTransTimes').val(jsData.PSInfo.PTransTimes);
                        $('#PGoHomeTimes').val(jsData.PSInfo.PGoHomeTimes);

                        $('#PersonName').html(jsData.PSInfo.PersonName);
                        $('#PDays').html(jsData.PSInfo.PDays + " 班");
                        $('#PTaskTimesEveryDay').html(parseFloat(jsData.PSInfo.PTaskTimesEveryDay).toFixed(2));
                        ComPTaskTimesEveryDay = parseFloat(jsData.PSInfo.PTaskTimesEveryDay).toFixed(2);

                        var vPAvgSendTime = jsData.PSInfo.PAvgSendTime;
                        $('#PAvgSendTime').html(formatSecondTime(vPAvgSendTime));
                        ComvPAvgSendTime = vPAvgSendTime;//全局变量 用于和全中心对应项做对比

                        var vPAvgArriveTime = jsData.PSInfo.PAvgArriveTime;
                        $('#PAvgArriveTime').html(formatSecondTime(vPAvgArriveTime));
                        ComvPAvgArriveTime = vPAvgArriveTime;

                        var vPAvgLocalAidTime = jsData.PSInfo.PAvgLocalAidTime;
                        $('#PAvgLocalAidTime').html(formatSecondTime(vPAvgLocalAidTime));
                        ComvPAvgLocalAidTime = vPAvgLocalAidTime;

                        var vPAvgTransTime = jsData.PSInfo.PAvgTransTime;
                        $('#PAvgTransTime').html(formatSecondTime(vPAvgTransTime));
                        ComvPAvgTransTime = vPAvgTransTime;

                        var vPAvgHospitalTransTime = jsData.PSInfo.PAvgHospitalTransTime;
                        $('#PAvgHospitalTransTime').html(formatSecondTime(vPAvgHospitalTransTime));
                        ComvPAvgHospitalTransTime = vPAvgHospitalTransTime;

                        var vPAvgReactTime = jsData.PSInfo.PAvgReactTime;
                        $('#PAvgReactTime').html(formatSecondTime(vPAvgReactTime));
                        ComvPAvgReactTime = vPAvgReactTime;

                        var vPAvgTurnTime = jsData.PSInfo.PAvgTurnTime;
                        $('#PAvgTurnTime').html(formatSecondTime(vPAvgTurnTime));
                        ComvPAvgTurnTime = vPAvgTurnTime;

                    }
                    //个人收费块
                    if (jsData.PSChargeInfo.PCharge > 0) {
                        $('#PKilometer').html(jsData.PSChargeInfo.PKilometer + " 公里");
                        $('#PCharge').html(jsData.PSChargeInfo.PCharge + " 元");
                        $('#PChargeCarFee').val(jsData.PSChargeInfo.PChargeCarFee);
                        $('#PChargeWaitFee').val(jsData.PSChargeInfo.PChargeWaitFee);
                        $('#PChargeAidFee').val(jsData.PSChargeInfo.PChargeAidFee);
                    }

                    //个人病历块
                    //急救处理率
                    var vPDisposeNumber = jsData.PSPRInfo.PDisposeNumber;
                    $('#PDisposeNumber').val(vPDisposeNumber);

                    var vPPRNumberExceptRefuseTreatment = jsData.PSPRInfo.PPRNumberExceptRefuseTreatment;
                    $('#PPRNumberExceptRefuseTreatment').val(vPPRNumberExceptRefuseTreatment);

                    if (vPPRNumberExceptRefuseTreatment != 0) {
                        $('#PDisposePercent').html(percentNum(vPDisposeNumber, vPPRNumberExceptRefuseTreatment));
                        ComPDisposePercent = percentNum(vPDisposeNumber, vPPRNumberExceptRefuseTreatment);
                    }
                    else {
                        $('#PDisposePercent').html("0%");
                        ComPDisposePercent = "0%";
                    }

                    //静脉开通率
                    var vPVeinNumber = jsData.PSPRInfo.PVeinNumber;
                    $('#PVeinNumber').val(vPVeinNumber);

                    var vPPRNumber = jsData.PSPRInfo.PPRNumber;
                    $('#PPRNumber').val(vPPRNumber);

                    if (vPPRNumber != 0) {
                        $('#PVeinPercent').html(percentNum(vPVeinNumber, vPPRNumber));
                        ComPVeinPercent = percentNum(vPVeinNumber, vPPRNumber);
                    }
                    else {
                        $('#PVeinPercent').html("0%");
                        ComPVeinPercent = "0%";
                    }
                    //ROSC
                    var vPROSCNumber = jsData.PSPRInfo.PROSCNumber;
                    $('#PROSCNumber').val(vPROSCNumber);

                    var vPCPRNumber = jsData.PSPRInfo.PCPRNumber;
                    $('#PCPRNumber').val(vPCPRNumber);

                    if (vPCPRNumber != 0) {
                        $('#PROSCPercent').html(percentNum(vPROSCNumber, vPCPRNumber));
                        ComPROSCPercent = percentNum(vPROSCNumber, vPCPRNumber);
                    }
                    else {
                        $('#PROSCPercent').html("0%");
                        ComPROSCPercent = "0%";
                    }
                    setpPToolTip();
                    getTotalInfo();

                }
            });
        }
        function setpPToolTip() {

            var pTimesDetial = ' 急救：' + $('#PFirstAidTimes').val() + '次， 转院：' + $('#PTransTimes').val() + '次， 回家：' + $('#PGoHomeTimes').val() + '次。   ';
            //此段内容为，ajax取 急救、转院、回家的出车数 ，然后赋值给content 的内容。显示在tooltip里。
            $('#ptooltipTT').tooltip({
                position: 'right',
                content: pTimesDetial,
                onShow: function () {
                    $(this).tooltip('tip').css({
                        backgroundColor: '#DCDAEF',
                        borderColor: '#DCDAEF'
                    });
                }
            });
            var pDPDetial = '已治疗：' + $('#PDisposeNumber').val() + '， 共救治（不包括拒绝治疗）：' + $('#PPRNumberExceptRefuseTreatment').val() + "    ";
            $('#ptooltipDP').tooltip({
                position: 'right',
                content: pDPDetial,
                onShow: function () {
                    $(this).tooltip('tip').css({
                        backgroundColor: '#D2F1F6',
                        borderColor: '#D2F1F6'
                    });
                }
            });
            var pPCDetial = ' 车费：' + $('#PChargeCarFee').val() + '元, 治疗费：' + $('#PChargeAidFee').val() + '元, 等候费：' + $('#PChargeWaitFee').val() + '元。   ';
            $('#ptooltipPC').tooltip({
                position: 'right',
                content: pPCDetial,
                onShow: function () {
                    $(this).tooltip('tip').css({
                        backgroundColor: '#FFD4CF',
                        borderColor: '#FFD4CF'
                    });
                }
            });
            var pVPDetial = '静脉开通数：' + $('#PVeinNumber').val() + ' , 病历数：' + $('#PPRNumber').val() + "    ";
            $('#ptooltipVP').tooltip({
                position: 'right',
                content: pVPDetial,
                onShow: function () {
                    $(this).tooltip('tip').css({
                        backgroundColor: '#FFE48D',
                        borderColor: '#FFE48D'
                    });
                }
            });
            var pROSCDetial = '复苏成功数：' + $('#PROSCNumber').val() + ' ， 心肺复苏数：' + $('#PCPRNumber').val() + "    ";
            $('#ptooltipROSC').tooltip({
                position: 'right',
                content: pROSCDetial,
                onShow: function () {
                    $(this).tooltip('tip').css({
                        backgroundColor: '#A8C0EC',
                        borderColor: '#A8C0EC'
                    });
                }
            });
        }

        var ComTTaskTimesEveryDay;//声明全局变量，用于对比
        var ComvTAvgSendTime;
        var ComvTAvgArriveTime;
        var ComvTAvgLocalAidTime;
        var ComvTAvgTransTime;
        var ComvTAvgHospitalTransTime;
        var ComvTAvgReactTime;
        var ComvTAvgTurnTime;
        var ComTDisposePercent;
        var ComTVeinPercent;
        var ComTROSCPercent;

        //获取全中心数据，在success中将数据赋予页面，同时赋给全局变量，用于对比方法。
        function getTotalInfo() {
            $.ajax({
                type: 'POST',
                url: '@Url.Content("~/BB/TJRedirectLink/GetTotalStatistics")',
                data:
                    {
                        beginTime: $('#StartDate').datebox('getValue'),
                        endTime: $('#EndDate').datebox('getValue')
                    },
                dataType: "json",
                success: function (jsData) {

                    //调度块
                    $('#TTaskTimes').html(jsData.CSInfo.TTaskTimes);

                    $('#TFirstAidTimes').val(jsData.CSInfo.TFirstAidTimes);
                    $('#TTransTimes').val(jsData.CSInfo.TTransTimes);
                    $('#TGoHomeTimes').val(jsData.CSInfo.TGoHomeTimes);

                    $('#TDays').html(jsData.CSInfo.TDays + " 班");
                    parseFloat(jsData.CSInfo.TTaskTimesEveryDay).toFixed(2)
                    $('#TTaskTimesEveryDay').html(parseFloat(jsData.CSInfo.TTaskTimesEveryDay).toFixed(2));
                    ComTTaskTimesEveryDay = parseFloat(jsData.CSInfo.TTaskTimesEveryDay).toFixed(2);

                    var vTAvgSendTime = jsData.CSInfo.TAvgSendTime;
                    $('#TAvgSendTime').html(formatSecondTime(vTAvgSendTime));
                    ComvTAvgSendTime = vTAvgSendTime; // 全局变量，用于和个人项对比

                    var vTAvgArriveTime = jsData.CSInfo.TAvgArriveTime;
                    $('#TAvgArriveTime').html(formatSecondTime(vTAvgArriveTime));
                    ComvTAvgArriveTime = vTAvgArriveTime;

                    var vTAvgLocalAidTime = jsData.CSInfo.TAvgLocalAidTime;
                    $('#TAvgLocalAidTime').html(formatSecondTime(vTAvgLocalAidTime));
                    ComvTAvgLocalAidTime = vTAvgLocalAidTime;

                    var vTAvgTransTime = jsData.CSInfo.TAvgTransTime;
                    $('#TAvgTransTime').html(formatSecondTime(vTAvgTransTime));
                    ComvTAvgTransTime = vTAvgTransTime;

                    var vTAvgHospitalTransTime = jsData.CSInfo.TAvgHospitalTransTime;
                    $('#TAvgHospitalTransTime').html(formatSecondTime(vTAvgHospitalTransTime));
                    ComvTAvgHospitalTransTime = vTAvgHospitalTransTime;

                    var vTAvgReactTime = jsData.CSInfo.TAvgReactTime;
                    $('#TAvgReactTime').html(formatSecondTime(vTAvgReactTime));
                    ComvTAvgReactTime = vTAvgReactTime;

                    var vTAvgTurnTime = jsData.CSInfo.TAvgTurnTime;
                    $('#TAvgTurnTime').html(formatSecondTime(vTAvgTurnTime));
                    ComvTAvgTurnTime = vTAvgTurnTime;


                    //收费块
                    $('#TKilometer').html(jsData.CSChargeInfo.TKilometer + " 公里");

                    $('#TCharge').html(jsData.CSChargeInfo.TCharge + " 元");
                    $('#TChargeCarFee').val(jsData.CSChargeInfo.TChargeCarFee);
                    $('#TChargeWaitFee').val(jsData.CSChargeInfo.TChargeWaitFee);
                    $('#TChargeAidFee').val(jsData.CSChargeInfo.TChargeAidFee);


                    //个人病历块
                    var vTDisposeNumber = jsData.CSPRInfo.TDisposeNumber;
                    $('#TDisposeNumber').val(vTDisposeNumber);

                    var vTPRNumberExceptRefuseTreatment = jsData.CSPRInfo.TPRNumberExceptRefuseTreatment;
                    $('#TPRNumberExceptRefuseTreatment').val(vTPRNumberExceptRefuseTreatment);

                    if (vTPRNumberExceptRefuseTreatment != 0) {

                        $('#TDisposePercent').html(percentNum(vTDisposeNumber, vTPRNumberExceptRefuseTreatment));
                        ComTDisposePercent = percentNum(vTDisposeNumber, vTPRNumberExceptRefuseTreatment);
                    }
                    else {
                        $('#TDisposePercent').html("0%");
                        ComTDisposePercent = "0%";
                    }

                    var vTVeinNumber = jsData.CSPRInfo.TVeinNumber;
                    $('#TVeinNumber').val(vTVeinNumber);

                    var vTPRNumber = jsData.CSPRInfo.TPRNumber;
                    $('#TPRNumber').val(vTPRNumber);

                    if (vTPRNumber != 0) {

                        $('#TVeinPercent').html(percentNum(vTVeinNumber, vTPRNumber));
                        ComTVeinPercent = percentNum(vTVeinNumber, vTPRNumber);

                    }
                    else {
                        $('#TVeinPercent').html("0%");
                        ComTVeinPercent = "0%";
                    }

                    var vTROSCNumber = jsData.CSPRInfo.TROSCNumber;
                    $('#TROSCNumber').val(vTROSCNumber);

                    var vTCPRNumber = jsData.CSPRInfo.TCPRNumber;
                    $('#TCPRNumber').val(vTCPRNumber);

                    if (vTCPRNumber != 0) {

                        $('#TROSCPercent').html(percentNum(vTROSCNumber, vTCPRNumber));
                        ComTROSCPercent = percentNum(vTROSCNumber, vTCPRNumber);
                    }
                    else {
                        $('#TROSCPercent').html("0%");
                        ComTROSCPercent = "0%";
                    }
                    setpTToolTip();

                    ComparePersonANDTotal();
                }
            });

        }

        function setpTToolTip() {

            var tTimesDetial = '急救：' + $('#TFirstAidTimes').val() + '次， 转院:' + $('#TTransTimes').val() + '次， 回家：' + $('#TGoHomeTimes').val() + '次。   ';

            $('#ttooltipTT').tooltip({
                position: 'left',
                content: tTimesDetial,
                onShow: function () {
                    $(this).tooltip('tip').css({
                        backgroundColor: '#DCDAEF',
                        borderColor: '#DCDAEF'
                    });
                }
            });
            var tDPDetial = '已治疗：' + $('#TDisposeNumber').val() + '， 共救治（不包括拒绝治疗）：' + $('#TPRNumberExceptRefuseTreatment').val() + "     ";
            $('#ttooltipDP').tooltip({
                position: 'left',
                content: tDPDetial,
                onShow: function () {
                    $(this).tooltip('tip').css({
                        backgroundColor: '#D2F1F6',
                        borderColor: '#D2F1F6'
                    });
                }
            });

            var tPCDetial = '车费：' + $('#TChargeCarFee').val() + '元， 治疗费:' + $('#TChargeAidFee').val() + '元， 等候费' + $('#TChargeWaitFee').val() + "元。   ";
            $('#ttooltipPC').tooltip({
                position: 'left',
                content: tPCDetial,
                onShow: function () {
                    $(this).tooltip('tip').css({
                        backgroundColor: '#FFD4CF',
                        borderColor: '#FFD4CF'
                    });
                }
            });

            var tVPDetial = '静脉开通数：' + $('#TVeinNumber').val() + '， 病历数：' + $('#TPRNumber').val() + "    ";
            $('#ttooltipVP').tooltip({
                position: 'left',
                content: tVPDetial,
                onShow: function () {
                    $(this).tooltip('tip').css({
                        backgroundColor: '#FFE48D',
                        borderColor: '#FFE48D'
                    });
                }
            });

            var tROSCDetial = '复苏成功数：' + $('#TROSCNumber').val() + '， 心肺复苏数：' + $('#TCPRNumber').val() + "    ";
            $('#ttooltipROSC').tooltip({
                position: 'left',
                content: tROSCDetial,
                onShow: function () {
                    $(this).tooltip('tip').css({
                        backgroundColor: '#A8C0EC',
                        borderColor: '#A8C0EC'
                    });
                }
            });
        }



        //数红色箭头的数量，
        var RedNumber = 0;

        function ComparePersonANDTotal() {

            //ComPTaskTimesEveryDay 人均出车次数
            if (CompareFloat(ComPTaskTimesEveryDay, ComTTaskTimesEveryDay) == 'red') {
                $("#PTaskTimesEveryDayImageRed").show();//显示
                $("#PTaskTimesEveryDayImageGreen").hide();//隐藏
                RedNumber = RedNumber + 1;

                if (ComparePercentMath(ComPTaskTimesEveryDay, ComTTaskTimesEveryDay)) {
                    $('#PTaskTimesEveryDayTips').html('<span style="color:red">/平均比中心多了' + myFix(CompareFloatMath(ComPTaskTimesEveryDay, ComTTaskTimesEveryDay)) + '  次</span>')
                }

            } else if (CompareFloat(ComPTaskTimesEveryDay, ComTTaskTimesEveryDay) == 'green') {

                $("#PTaskTimesEveryDayImageRed").hide();//隐藏
                $("#PTaskTimesEveryDayImageGreen").show();// 显示

                if (ComparePercentMath(ComPTaskTimesEveryDay, ComTTaskTimesEveryDay)) {
                    $('#PTaskTimesEveryDayTips').html('<span style="color:green">/平均比中心少了' + myFix(CompareFloatMath(ComPTaskTimesEveryDay, ComTTaskTimesEveryDay)) + '  次</span>')
                }
            }
            else if (CompareFloat(ComPTaskTimesEveryDay, ComTTaskTimesEveryDay) == 'black') {


                $("#PTaskTimesEveryDayImageRed").hide();//隐藏
                $("#PTaskTimesEveryDayImageGreen").hide();// 隐藏
            }



            //ComvPAvgSendTime  平均出车时间
            if (CompareInt(ComvPAvgSendTime, ComvTAvgSendTime) == 'red') {
                $("#PAvgSendTimeRed").hide();//显示
                $("#PAvgSendTimeGreen").show();//隐藏

                if (ComparePercentMath(ComvPAvgSendTime, ComvTAvgSendTime)) {

                    $('#PAvgSendTimeTips').html('<span style="color:green">/平均比中心慢了' + formatSecondTime(CompareMath(ComvPAvgSendTime, ComvTAvgSendTime)) + '</span>')
                }

            } else if (CompareInt(ComvPAvgSendTime, ComvTAvgSendTime) == 'green') {
                $("#PAvgSendTimeRed").show();//隐藏
                $("#PAvgSendTimeGreen").hide();// 显示
                RedNumber = RedNumber + 1;
                if (ComparePercentMath(ComvPAvgSendTime, ComvTAvgSendTime)) {
                    $('#PAvgSendTimeTips').html('<span style="color:red">/平均比中心快了' + formatSecondTime(CompareMath(ComvPAvgSendTime, ComvTAvgSendTime)) + '</span>')
                }
            }
            else if (CompareInt(ComvPAvgSendTime, ComvTAvgSendTime) == 'black') {
                $("#PAvgSendTimeRed").hide();//隐藏
                $("#PAvgSendTimeGreen").hide();// 隐藏
            }

            //   平均到达现场时间
            if (CompareFloat(ComvPAvgArriveTime, ComvTAvgArriveTime) == 'red') {
                $("#PAvgArriveTimeRed").hide();//显示
                $("#PAvgArriveTimeGreen").show();//隐藏

                if (ComparePercentMath(ComvPAvgArriveTime, ComvTAvgArriveTime)) {
                    $('#PAvgArriveTimeTips').html('<span style="color:green">/平均比中心慢了' + formatSecondTime(CompareMath(ComvPAvgArriveTime, ComvTAvgArriveTime)) + '</span>')
                }

            } else if (CompareFloat(ComvPAvgArriveTime, ComvTAvgArriveTime) == 'green') {
                $("#PAvgArriveTimeRed").show();//隐藏
                $("#PAvgArriveTimeGreen").hide();// 显示
                RedNumber = RedNumber + 1;
                if (ComparePercentMath(ComvPAvgArriveTime, ComvTAvgArriveTime)) {
                    $('#PAvgArriveTimeTips').html('<span style="color:red">/平均比中心快了' + formatSecondTime(CompareMath(ComvPAvgArriveTime, ComvTAvgArriveTime)) + '</span>')
                }
            }
            else if (CompareFloat(ComvPAvgArriveTime, ComvTAvgArriveTime) == 'black') {
                $("#PAvgArriveTimeRed").hide();//隐藏
                $("#PAvgArriveTimeGreen").hide();// 隐藏
            }

            //   平均现场抢救时间
            if (CompareFloat(ComvPAvgLocalAidTime, ComvTAvgLocalAidTime) == 'red') {
                $("#PAvgLocalAidTimeRed").hide();//显示
                $("#PAvgLocalAidTimeGreen").show();//隐藏

                if (ComparePercentMath(ComvPAvgLocalAidTime, ComvTAvgLocalAidTime)) {
                    $('#PAvgLocalAidTimeTips').html('<span style="color:green">/平均比中心慢了' + formatSecondTime(CompareMath(ComvPAvgLocalAidTime, ComvTAvgLocalAidTime)) + '</span>')
                }

            } else if (CompareFloat(ComvPAvgLocalAidTime, ComvTAvgLocalAidTime) == 'green') {
                $("#PAvgLocalAidTimeRed").show();//隐藏
                $("#PAvgLocalAidTimeGreen").hide();// 显示
                RedNumber = RedNumber + 1;
                if (ComparePercentMath(ComvPAvgLocalAidTime, ComvTAvgLocalAidTime)) {
                    $('#PAvgLocalAidTimeTips').html('<span style="color:red">/平均比中心快了' + formatSecondTime(CompareMath(ComvPAvgLocalAidTime, ComvTAvgLocalAidTime)) + '</span>')
                }
            }
            else if (CompareFloat(ComvPAvgLocalAidTime, ComvTAvgLocalAidTime) == 'black') {
                $("#PAvgLocalAidTimeRed").hide();//隐藏
                $("#PAvgLocalAidTimeGreen").hide();// 隐藏
            }

            //   平均运送时间
            if (CompareFloat(ComvPAvgTransTime, ComvTAvgTransTime) == 'red') {
                $("#PAvgTransTimeRed").hide();//显示
                $("#PAvgTransTimeGreen").show();//隐藏

                if (ComparePercentMath(ComvPAvgTransTime, ComvTAvgTransTime)) {
                    $('#PAvgTransTimeTips').html('<span style="color:green">/平均比中心慢了' + formatSecondTime(CompareMath(ComvPAvgTransTime, ComvTAvgTransTime)) + '</span>')
                }

            } else if (CompareFloat(ComvPAvgTransTime, ComvTAvgTransTime) == 'green') {
                $("#PAvgTransTimeRed").show();//隐藏
                $("#PAvgTransTimeGreen").hide();// 显示
                RedNumber = RedNumber + 1;
                if (ComparePercentMath(ComvPAvgTransTime, ComvTAvgTransTime)) {
                    $('#PAvgTransTimeTips').html('<span style="color:red">/平均比中心快了' + formatSecondTime(CompareMath(ComvPAvgTransTime, ComvTAvgTransTime)) + '</span>')
                }
            }
            else if (CompareFloat(ComvPAvgTransTime, ComvTAvgTransTime) == 'black') {
                $("#PAvgTransTimeRed").hide();//隐藏
                $("#PAvgTransTimeGreen").hide();// 隐藏
            }

            //   平均医院交接时间
            if (CompareFloat(ComvPAvgHospitalTransTime, ComvTAvgHospitalTransTime) == 'red') {
                $("#PAvgHospitalTransTimeRed").hide();//显示
                $("#PAvgHospitalTransTimeGreen").show();//隐藏

                if (ComparePercentMath(ComvPAvgHospitalTransTime, ComvTAvgHospitalTransTime)) {
                    $('#PAvgHospitalTransTimeTips').html('<span style="color:green">/平均比中心慢了' + formatSecondTime(CompareMath(ComvPAvgHospitalTransTime, ComvTAvgHospitalTransTime)) + '</span>')
                }

            } else if (CompareFloat(ComvPAvgHospitalTransTime, ComvTAvgHospitalTransTime) == 'green') {
                $("#PAvgHospitalTransTimeRed").show();//隐藏
                $("#PAvgHospitalTransTimeGreen").hide();// 显示
                RedNumber = RedNumber + 1;
                if (ComparePercentMath(ComvPAvgHospitalTransTime, ComvTAvgHospitalTransTime)) {
                    $('#PAvgHospitalTransTimeTips').html('<span style="color:red">/平均比中心快了' + formatSecondTime(CompareMath(ComvPAvgHospitalTransTime, ComvTAvgHospitalTransTime)) + '</span>')
                }
            }
            else if (CompareFloat(ComvPAvgHospitalTransTime, ComvTAvgHospitalTransTime) == 'black') {
                $("#PAvgHospitalTransTimeRed").hide();//隐藏
                $("#PAvgHospitalTransTimeGreen").hide();// 隐藏
            }

            //   平均反应时间
            if (CompareFloat(ComvPAvgReactTime, ComvTAvgReactTime) == 'red') {
                $("#PAvgReactTimeRed").hide();//显示
                $("#PAvgReactTimeGreen").show();//隐藏

                if (ComparePercentMath(ComvPAvgReactTime, ComvTAvgReactTime)) {
                    $('#PAvgReactTimeTips').html('<span style="color:green">/平均比中心慢了' + formatSecondTime(CompareMath(ComvPAvgReactTime, ComvTAvgReactTime)) + '</span>')
                }

            } else if (CompareFloat(ComvPAvgReactTime, ComvTAvgReactTime) == 'green') {
                $("#PAvgReactTimeRed").show();//隐藏
                $("#PAvgReactTimeGreen").hide();// 显示
                RedNumber = RedNumber + 1;
                if (ComparePercentMath(ComvPAvgReactTime, ComvTAvgReactTime)) {
                    $('#PAvgReactTimeTips').html('<span style="color:red">/平均比中心快了' + formatSecondTime(CompareMath(ComvPAvgReactTime, ComvTAvgReactTime)) + '</span>')
                }
            }
            else if (CompareFloat(ComvPAvgReactTime, ComvTAvgReactTime) == 'black') {
                $("#PAvgReactTimeRed").hide();//隐藏
                $("#PAvgReactTimeGreen").hide();// 隐藏
            }

            //   平均周转时间
            if (CompareFloat(ComvPAvgTurnTime, ComvTAvgTurnTime) == 'red') {
                $("#PAvgTurnTimeRed").hide();//显示
                $("#PAvgTurnTimeGreen").show();//隐藏

                if (ComparePercentMath(ComvPAvgTurnTime, ComvTAvgTurnTime)) {

                    $('#PAvgTurnTimeTips').html('<span style="color:green">/平均比中心慢了' + formatSecondTime(CompareMath(ComvPAvgTurnTime, ComvTAvgTurnTime)) + '</span>')
                }

            } else if (CompareFloat(ComvPAvgTurnTime, ComvTAvgTurnTime) == 'green') {
                $("#PAvgTurnTimeRed").show();//隐藏
                $("#PAvgTurnTimeGreen").hide();// 显示
                RedNumber = RedNumber + 1;
                if (ComparePercentMath(ComvPAvgTurnTime, ComvTAvgTurnTime)) {
                    $('#PAvgTurnTimeTips').html('<span style="color:red">/平均比中心快了' + formatSecondTime(CompareMath(ComvPAvgTurnTime, ComvTAvgTurnTime)) + '</span>')
                }
            }
            else if (CompareFloat(ComvPAvgTurnTime, ComvTAvgTurnTime) == 'black') {
                $("#PAvgTurnTimeRed").hide();//隐藏
                $("#PAvgTurnTimeGreen").hide();// 隐藏
            }

            //   急救处理率
            if (CompareFloat(ComPDisposePercent, ComTDisposePercent) == 'red') {
                $("#PDisposePercentRed").show();//显示
                $("#PDisposePercentGreen").hide();//隐藏
                RedNumber = RedNumber + 1;
                if (ComparePercentMath(ComPDisposePercent, ComTDisposePercent)) {
                    $('#PDisposePercentTips').html('<span style="color:red">/平均比中心多了' + myFix(ComparePercentMath(ComPDisposePercent, ComTDisposePercent)) + '  %</span>')
                }

            } else if (CompareFloat(ComPDisposePercent, ComTDisposePercent) == 'green') {
                $("#PDisposePercentRed").hide();//隐藏
                $("#PDisposePercentGreen").show();// 显示
                if (ComparePercentMath(ComPDisposePercent, ComTDisposePercent)) {

                    $('#PDisposePercentTips').html('<span style="color:green">/平均比中心少了' + myFix(ComparePercentMath(ComPDisposePercent, ComTDisposePercent)) + '  %</span>')
                }
            }
            else if (CompareFloat(ComPDisposePercent, ComTDisposePercent) == 'black') {
                $("#PDisposePercentRed").hide();//隐藏
                $("#PDisposePercentGreen").hide();// 隐藏
            }


            //   静脉开通率
            if (CompareFloat(ComPVeinPercent, ComTVeinPercent) == 'red') {
                $("#PVeinPercentRed").show();//显示
                $("#PVeinPercentGreen").hide();//隐藏
                RedNumber = RedNumber + 1;
                if (ComparePercentMath(ComPVeinPercent, ComTVeinPercent)) {
                    $('#PVeinPercentTips').html('<span style="color:red">/平均比中心多了' + myFix(ComparePercentMath(ComPVeinPercent, ComTVeinPercent)) + '  %</span>')
                }

            } else if (CompareFloat(ComPVeinPercent, ComTVeinPercent) == 'green') {
                $("#PVeinPercentRed").hide();//隐藏
                $("#PVeinPercentGreen").show();// 显示
                if (ComparePercentMath(ComPVeinPercent, ComTDisposePercent)) {

                    $('#PVeinPercentTips').html('<span style="color:green">/平均比中心少了' + myFix(ComparePercentMath(ComPVeinPercent, ComTVeinPercent)) + '  %</span>')
                }
            }
            else if (CompareFloat(ComPVeinPercent, ComTVeinPercent) == 'black') {
                $("#PVeinPercentRed").hide();//隐藏
                $("#PVeinPercentGreen").hide();// 隐藏
            }


            //   复苏成功率
            if (CompareFloat(ComPROSCPercent, ComTROSCPercent) == 'red') {
                $("#PROSCPercentRed").show();//显示
                $("#PROSCPercentGreen").hide();//隐藏
                if (ComparePercentMath(ComPROSCPercent, ComTROSCPercent)) {
                    $('#PROSCPercentTips').html('<span style="color:red">/平均比中心多了' + myFix(ComparePercentMath(ComPROSCPercent, ComTROSCPercent)) + '  %</span>')
                }

            } else if (CompareFloat(ComPROSCPercent, ComTROSCPercent) == 'green') {
                $("#PROSCPercentRed").hide();//隐藏
                $("#PROSCPercentGreen").show();// 显示

                if (ComparePercentMath(ComPROSCPercent, ComTROSCPercent)) {

                    $('#PROSCPercentTips').html('<span style="color:green">/平均比中心少了' + myFix(ComparePercentMath(ComPROSCPercent, ComTROSCPercent)) + '  %</span>')
                }
            }
            else if (CompareFloat(ComPROSCPercent, ComTROSCPercent) == 'black') {
                $("#PROSCPercentRed").hide();//隐藏
                $("#PROSCPercentGreen").hide();// 隐藏
            }

        
           CompareRedNumber(RedNumber);
           RedNumber = 0;
        }

        function CompareRedNumber(RedNumber) {
         
            //if (parseInt(RedNumber) <= 4) {
            //    alert("a");
            //    $("#youxiuImg").hide(); $("#lianghaoImg").hide(); $("#yibanImg").show();
            //}
            //else if (4 < parseInt(RedNumber) < 8) {
            //    alert("b");
            //    $("#youxiuImg").hide(); $("#lianghaoImg").show(); $("#yibanImg").hide();
            //}
            //else if (8 <= parseInt(RedNumber) <= 10) {
            //    alert("c");
            //    $("#youxiuImg").show(); $("#lianghaoImg").hide(); $("#yibanImg").hide();
            //}
            switch (RedNumber) {
                case 0: case 1: case 2: case 3:
                    $("#youxiuImg").hide(); $("#lianghaoImg").hide(); $("#yibanImg").show();
                    break;
                case 4: case 5: case 6: case 7:
                    $("#youxiuImg").hide(); $("#lianghaoImg").show(); $("#yibanImg").hide();
                    break;
                case 8: case 9: case 10:
                    $("#youxiuImg").show(); $("#lianghaoImg").hide(); $("#yibanImg").hide();
                    break;
                default:
                    break;
            }



        }
    </script>


}
<div id="divIndex" class="easyui-layout" style="width:auto; height: auto; margin-left: auto;margin-right: auto">

    <div>
        <input name="ChargeCarFee" type="hidden" id="PChargeCarFee" />
        <input name="ChargeWaitFee" type="hidden" id="PChargeWaitFee" />
        <input name="ChargeAidFee" type="hidden" id="PChargeAidFee" />
        <input name="FirstAidTimes" type="hidden" id="PFirstAidTimes" />
        <input name="TransTimes" type="hidden" id="PTransTimes" />
        <input name="GoHomeTimes" type="hidden" id="PGoHomeTimes" />
        <input name="DisposeNumber" type="hidden" id="PDisposeNumber" />
        <input name="PRNumberExceptRefuseTreatment" type="hidden" id="PPRNumberExceptRefuseTreatment" />
        <input name="VeinNumber" type="hidden" id="PVeinNumber" />
        <input name="PRNumber" type="hidden" id="PPRNumber" />
        <input name="ROSCNumber" type="hidden" id="PROSCNumber" />
        <input name="CPRNumber" type="hidden" id="PCPRNumber" />


        <input name="TChargeCarFee" type="hidden" id="TChargeCarFee" />
        <input name="TChargeWaitFee" type="hidden" id="TChargeWaitFee" />
        <input name="TChargeAidFee" type="hidden" id="TChargeAidFee" />
        <input name="TFirstAidTimes" type="hidden" id="TFirstAidTimes" />
        <input name="TTransTimes" type="hidden" id="TTransTimes" />
        <input name="TGoHomeTimes" type="hidden" id="TGoHomeTimes" />
        <input name="TDisposeNumber" type="hidden" id="TDisposeNumber" />
        <input name="TPRNumberExceptRefuseTreatment" type="hidden" id="TPRNumberExceptRefuseTreatment" />
        <input name="TVeinNumber" type="hidden" id="TVeinNumber" />
        <input name="TPRNumber" type="hidden" id="TPRNumber" />
        <input name="TROSCNumber" type="hidden" id="TROSCNumber" />
        <input name="TCPRNumber" type="hidden" id="TCPRNumber" />
    </div>
    <div id="divIndexMain" data-options="region:'center'" style="padding: 5px; background:#E4F2FB;">

        <div id="tbs" class="easyui-tabs" data-options="fit:true,border:false">

            <div title="个人&中心 业绩对比" data-options="iconCls:'icon-redo',closable:false" style="padding:20px;">
                <div id="SearchBar" data-options="region:'north'" style="overflow: hidden; padding: 5px;width:99%">
                    <table border="0" width="99%">
                        <tr>
                            <td>
                                <table>
                                    <tr>
                                        <td>查询时间：</td>
                                        <td>
                                            <input id="StartDate" class="easyui-datetimebox" style="width:150px" data-options="required:true" />
                                        </td>
                                        <td>至</td>
                                        <td>
                                            <input id="EndDate" class="easyui-datetimebox" style="width:150px" data-options="required:true" />
                                        </td>

                                        <td rowspan="2">
                                            &nbsp;&nbsp;
                                            <a href="javascript:void(0)" id="btnsearch" class="easyui-linkbutton" data-options="iconCls:'icon-search'" onclick="reSearch()">查询</a>
                                        </td>
                                    </tr>
                                </table>
                            </td>
                            <td valign="top">
                                <span style="font-size:large"> 您的业务对比总体结果：</span><img src="~/Images/Custom/youxiu.png" id="youxiuImg" style="height:60px" /><img src="~/Images/Custom/lianghao.png" id="lianghaoImg" style="height:60px" /><img src="~/Images/Custom/yiban.png" id="yibanImg" style="height:60px" />
                            </td>
                        </tr>
                    </table>
                </div>

                <table border="0" cellpadding="0" cellspacing="0" style="width: 96%;  text-align: left; margin-left: 10px; margin-right: 10px">
                    <tr style="height:40px;font-size:large;font-style:normal">
                        <td align="center" colspan="2">
                            <img src="~/Images/Custom/person.png" style="width:30px;height:30px" /> <span id="PersonName" style="width:100px;">
                            </span>
                        </td>
                        <td align="center" colspan="2">
                            <img src="~/Images/Custom/bigcenter.png" style="width:30px;height:30px" />&nbsp;&nbsp;全中心
                        </td>
                    </tr>
                    <tr style="height:27px;">
                        <td align="right" style=" width:10%;">
                            <label id="ptooltipTT">出车次数：</label>

                        </td>
                        <td style=" width:13%;">
                            <span id="PTaskTimes" style="width:100px;"></span>
                        </td>
                        <td align="right" style="width:12%;">
                            <label id="ttooltipTT">出车次数：</label>

                        </td>
                        <td style=" width:16%;">
                            <span id="TTaskTimes" style="width:100px;"></span>
                        </td>
                    </tr>
                    <tr style="height:27px;">
                        <td align="right">
                            当班数：
                        </td>
                        <td>
                            <span id="PDays" style="width:100px;"></span>
                        </td>
                        <td align="right">
                            当班数：
                        </td>
                        <td>
                            <span id="TDays" style="width:100px;"></span>
                        </td>
                    </tr>
                    <tr style="height:33px;">
                        <td align="right">
                            人均班出车次数：
                        </td>
                        <td>
                            <span id="PTaskTimesEveryDay" style="width:100px;"></span><span id="PTaskTimesEveryDayTips"></span> <img src="~/Images/Custom/redup.png" id="PTaskTimesEveryDayImageRed" /><img src="~/Images/Custom/greendown.png" id="PTaskTimesEveryDayImageGreen" />
                        </td>
                        <td align="right">
                            人均班出车次数：
                        </td>
                        <td>
                            <span id="TTaskTimesEveryDay" style="width:100px;"></span>
                        </td>
                    </tr>
                    <tr style="height:33px;">
                        <td align="right">
                            平均出车时间：
                        </td>
                        <td>
                            <span id="PAvgSendTime" style="width:100px;"></span><span id="PAvgSendTimeTips"></span><img src="~/Images/Custom/redup.png" id="PAvgSendTimeRed" /><img src="~/Images/Custom/greendown.png" id="PAvgSendTimeGreen" />
                        </td>
                        <td align="right">
                            平均出车时间：
                        </td>
                        <td>
                            <span id="TAvgSendTime" style="width:100px;"></span>
                        </td>
                    </tr>
                    <tr style="height:33px;">
                        <td align="right">平均到达现场时间：</td>
                        <td>
                            <span id="PAvgArriveTime" style="width:100px;"></span><span id="PAvgArriveTimeTips"></span><img src="~/Images/Custom/redup.png" id="PAvgArriveTimeRed" /><img src="~/Images/Custom/greendown.png" id="PAvgArriveTimeGreen" />
                        </td>
                        <td align="right">平均到达现场时间：</td>
                        <td>
                            <span id="TAvgArriveTime" style="width:100px;"></span>
                        </td>
                    </tr>
                    <tr style="height:33px;">
                        <td align="right">平均现场抢救时间：</td>
                        <td>
                            <span id="PAvgLocalAidTime" style="width:100px;"></span><span id="PAvgLocalAidTimeTips"></span><img src="~/Images/Custom/redup.png" id="PAvgLocalAidTimeRed" /><img src="~/Images/Custom/greendown.png" id="PAvgLocalAidTimeGreen" />
                        </td>
                        <td align="right">平均现场抢救时间：</td>
                        <td>
                            <span id="TAvgLocalAidTime" style="width:100px;"></span>
                        </td>
                    </tr>
                    <tr style="height:33px;">
                        <td align="right">平均运送时间：</td>
                        <td>
                            <span id="PAvgTransTime" style="width:100px;"></span><span id="PAvgTransTimeTips"></span><img src="~/Images/Custom/redup.png" id="PAvgTransTimeRed" /><img src="~/Images/Custom/greendown.png" id="PAvgTransTimeGreen" />
                        </td>
                        <td align="right">平均运送时间：</td>
                        <td>
                            <span id="TAvgTransTime" style="width:100px;"></span>
                        </td>
                    </tr>
                    <tr style="height:33px;">
                        <td align="right">平均医院交接时间：</td>
                        <td>
                            <span id="PAvgHospitalTransTime" style="width:100px;"></span><span id="PAvgHospitalTransTimeTips"></span><img src="~/Images/Custom/redup.png" id="PAvgHospitalTransTimeRed" /><img src="~/Images/Custom/greendown.png" id="PAvgHospitalTransTimeGreen" />
                        </td>
                        <td align="right">平均医院交接时间：</td>
                        <td>
                            <span id="TAvgHospitalTransTime" style="width:100px;"></span>
                        </td>
                    </tr>
                    <tr style="height:33px;">
                        <td align="right">平均反应时间：</td>
                        <td>
                            <span id="PAvgReactTime" style="width:100px;"></span><span id="PAvgReactTimeTips"></span><img src="~/Images/Custom/redup.png" id="PAvgReactTimeRed" /><img src="~/Images/Custom/greendown.png" id="PAvgReactTimeGreen" />
                        </td>
                        <td align="right">平均反应时间：</td>
                        <td>
                            <span id="TAvgReactTime" style="width:100px;"></span>
                        </td>
                    </tr>
                    <tr style="height:33px;">
                        <td align="right">平均周转时间：</td>
                        <td>
                            <span id="PAvgTurnTime" style="width:100px;"></span><span id="PAvgTurnTimeTips"></span><img src="~/Images/Custom/redup.png" id="PAvgTurnTimeRed" /><img src="~/Images/Custom/greendown.png" id="PAvgTurnTimeGreen" />
                        </td>
                        <td align="right">平均周转时间：</td>
                        <td>
                            <span id="TAvgTurnTime" style="width:100px;"></span>
                        </td>
                    </tr>

                    <tr style="height:28px;">
                        <td align="right">收费公里数：</td>
                        <td>
                            <span id="PKilometer" style="width:100px;"></span>
                        </td>
                        <td align="right">收费公里数：</td>
                        <td>
                            <span id="TKilometer" style="width:100px;"></span>
                        </td>
                    </tr>
                    <tr style="height:28px;">
                        <td align="right">
                            <label id="ptooltipPC">收费金额：</label>
                        </td>
                        <td>
                            <span id="PCharge" style="width:100px;"></span>
                        </td>
                        <td align="right">
                            <label id="ttooltipPC">收费金额：</label>
                        </td>
                        <td>
                            <span id="TCharge" style="width:100px;"></span>
                        </td>
                    </tr>
                    <tr style="height:28px;">
                        <td align="right">
                            <label id="ptooltipDP">急救处理率：</label>

                        </td>
                        <td>
                            <span id="PDisposePercent" style="width:100px;"></span><span id="PDisposePercentTips"></span><img src="~/Images/Custom/redup.png" id="PDisposePercentRed" /><img src="~/Images/Custom/greendown.png" id="PDisposePercentGreen" />
                        </td>
                        <td align="right">
                            <label id="ttooltipDP">急救处理率：</label>

                        </td>
                        <td>
                            <span id="TDisposePercent" style="width:100px;"></span>
                        </td>
                    </tr>
                    <tr style="height:28px;">
                        <td align="right">
                            <label id="ptooltipVP">静脉开通率：</label>
                        </td>
                        <td>
                            <span id="PVeinPercent" style="width:100px;"></span><span id="PVeinPercentTips"></span><img src="~/Images/Custom/redup.png" id="PVeinPercentRed" /><img src="~/Images/Custom/greendown.png" id="PVeinPercentGreen" />
                        </td>
                        <td align="right">
                            <label id="ttooltipVP">静脉开通率：</label>
                        </td>
                        <td>
                            <span id="TVeinPercent" style="width:100px;"></span>
                        </td>
                    </tr>
                    <tr style="height:28px;">
                        <td align="right">
                            <label id="ptooltipROSC">复苏成功率：</label>
                        </td>
                        <td>
                            <span id="PROSCPercent" style="width:100px;"></span><span id="PROSCPercentTips"></span><img src="~/Images/Custom/redup.png" id="PROSCPercentRed" /><img src="~/Images/Custom/greendown.png" id="PROSCPercentGreen" />
                        </td>
                        <td align="right">
                            <label id="ttooltipROSC">复苏成功率：</label>
                        </td>
                        <td>
                            <span id="TROSCPercent" style="width:100px;"></span>
                        </td>
                    </tr>
                </table>
            </div>
          
            
        </div>
    </div>
</div>

